package src.DAO;

import java.sql.SQLException;
import java.util.List;

import org.openswing.swing.message.receive.java.VOListResponse;

import src.VO.CardStateVO;
import src.VO.ClientVO;

import com.j256.ormlite.dao.BaseDaoImpl;
import com.j256.ormlite.stmt.PreparedQuery;
import com.j256.ormlite.stmt.QueryBuilder;
import com.j256.ormlite.support.ConnectionSource;

public class ClientDaoImpl extends BaseDaoImpl<ClientVO, Integer> implements
ClientDaoInterface{

	public ClientDaoImpl(ConnectionSource connectionSource) throws SQLException {
		super(connectionSource, ClientVO.class);
		
	}

	@Override
	public ClientVO getById(Integer id) {
		List<ClientVO> result;
		QueryBuilder<ClientVO, Integer> qb = queryBuilder();

		try {
			qb.where().eq("idclients", id);
			PreparedQuery<ClientVO> querry = qb.prepare();
			result = query(querry);
			return result.get(0);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;

	}

}
